package com.atlansheng.rocketmqdemoboot.demos.consumer;

import com.alibaba.fastjson.JSON;
import com.atlansheng.rocketmqdemoboot.demos.Dto.MsgInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

/**
 * @ClassName: TeacherConsumer
 * @Description:
 * @Date 2024/03/04 11:57
 * @Author songshaoqiu
 **/
@Slf4j
@Service
@RocketMQMessageListener(topic = "studentTopic",consumerGroup = "MathTeacher")
public class TeacherConsumer implements RocketMQListener<String> {
    @Override
    public void onMessage(String message) {
        MsgInfo msgInfo = JSON.parseObject(message, MsgInfo.class);
        log.info("消费消息:"+msgInfo);
    }
}
